package Lib3d.SceneGraph.Impl;


import Lib3d.SceneGraph.Group;
import Lib3d.SceneGraph.Node;

import java.util.Collection;
import java.util.Iterator;
import java.util.Vector;

import javax.media.opengl.GLAutoDrawable;

/**
 * A scene graph group implementation.
 * 
 * @author Wassim Chegham
 * @author Miriam Baran-Surel
 * @version 0.1
 * @category Lib3d.SceneGraphImpl
 * 
 */
public class GroupImpl implements Group {

    Collection<Node> children;

    public GroupImpl() {
        this.children = new Vector<Node>();
    }

    public void addChild(final Node child) {
        this.children.add(child);
    }

    public Iterator<Node> childIterator() {
        return this.children.iterator();
    }

    public void draw(final GLAutoDrawable gLDrawable) {
        final Iterator<Node> it = this.childIterator();
        while (it.hasNext()) {
            it.next().draw(gLDrawable);
        }
    }

}
